package com.example.demo.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Qatype {
    private int qatId;
    private String qatTypeName;
    private List<Qalibrary> questions;


    @Id
    @Column(name = "QAT_ID", nullable = false)
    public int getQatId() {
        return qatId;
    }

    public void setQatId(int qatId) {
        this.qatId = qatId;
    }

    @Basic
    @Column(name = "QAT_typeName", nullable = true, length = 20)
    public String getQatTypeName() {
        return qatTypeName;
    }

    public void setQatTypeName(String qatTypeName) {
        this.qatTypeName = qatTypeName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Qatype qatype = (Qatype) o;
        return qatId == qatype.qatId &&
                Objects.equals(qatTypeName, qatype.qatTypeName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(qatId, qatTypeName);
    }

    @OneToMany(mappedBy = "type")
    public List<Qalibrary> getQuestions() {
        return questions;
    }

    public void setQuestions(List<Qalibrary> questions) {
        this.questions = questions;
    }
}
